If $f(x)=f(y)$ implies that $g(x)=g(y)$ is $g$ a function of $f$? Let $f: {\mathbb R}^n\to {\mathbb R}^p$ and $g: {\mathbb R}^n \to {\mathbb R}^q$ be two non-constant functions such that: $f(x)=f(y)$ implies that $g(x)=g(y)$, can we say that $g$ a function of $f$?

This is: $g(x)= h(f(x))$ for some function $h$.
Define 
$$h(x) = \left\{ 
\begin{array}{lc}
g(z) &amp; \mbox{ if there exists some } z \mbox{ such that } f(z)=x \\
\mbox{ anything} &amp; \mbox{otherwise}
\end{array}
\right.$$

Show that the given condition implies that $h$ is well defined, that is it does not depend on the choice of $z$.

Then, by definition 
$$h(f(x))=g(x) \forall x \in \mathbb R^d$$
I'm assuming that why you mean by "$g$ is a function of $f$" is "there exists a function $\mathfrak{F}$ such that $g=\mathfrak{F}(f)$".
$$\bigl(\forall x,y:f(x)=f(y)\implies g(x)=g(y)\bigr)\implies\exists \mathfrak{F}:g=\mathfrak{F}(f)$$

Consider $f(x)=x$. Any function $g$ having the same domain as $f$ will satisfy the first half of the above assertion. No matter what metafunction $\mathfrak{F}$ we examine, there will be functions $g$ satisfying the first half but not the second half of our assertion, so the assertion must be false.

So the answer to your question is no. Except possibly for some trivial and pathological universes of values for $x$ and $y$.