This is indeed true for total derivatives (assuming the derivatives are non-zero), The theorem stating this is called the "Inverse function theorem". For more than one variable, this involves Jacobians rather than derivatives, but the idea is the same.


The following setup should be sufficiently general: Tacitly underlying is an open set (a "phase space") $\Omega\subset{\mathbb R}^n$, and on $\Omega$ two scalar functions ("observables") $$X:\quad {\bf u}\mapsto X({\bf u})\ ,\qquad Y:\quad {\bf u}\mapsto Y({\bf u})$$ are defined. When the point ${\bf u}$ moves around in time according to some law $t\mapsto{\bf u}(t)\in\Omega$ then the "observables" $X$ and $Y$ become functions of time, too, and one is led to consider the functions $$x(t):=X\bigl({\bf u}(t)\bigr)\ ,\qquad y(t):=Y\bigl({\bf u}(t)\bigr)\ .$$ By the chain rule these functions have derivatives $$\dot x(t)=\nabla X\bigl({\bf u}(t)\bigr)\cdot{\bf u}'(t)\ ,$$ and similarly for $y(\cdot)$. At any given instant the quantity $${dy\over dx}:={\dot y(t)\over \dot x(t)}={\nabla Y\bigl({\bf u}(t)\bigr)\cdot{\bf u}'(t) \over \nabla X\bigl({\bf u}(t)\bigr)\cdot{\bf u}'(t)}$$ is obviously the reciprocal of ${dx\over dy}$.