I am not sure if you mean inversing the first function. If you use Cantor–Bernstein–Schroeder theorem, you don't have to construct a bijection (which has to have an inverse). You just have to provide two injections: one from $[2,4]\cup [6,10]$ to $(-2,2)$ and one back.
Well, that should be easy. You can use linear functions $f(x)=ax+b$ for some $a,b$ to map $[2,4]$ inside $(-2,2)$, say, into $[-1.5,-0,5]$, and $[6,10]$ into, say, $[0.5,1.5]$. So, use make two linear functions and then glue them into one using a declaration like $f(x)=f_1(x)$ if ..., and $f(x)=f_2(x)$ if ... .
Conversely, you can inject $(-2,2)$ into, say, $(6,10)\subseteq [2,4]\cup [6,10]$.