I have a single rigid body object, and its orientations in quaternion with respect to two coordinate systems, each is called original and prime, respectively; therefore, I have two quaternions $\mathbf{q} =<q_w, q_x, q_y, q_z>$ and $\mathbf{q'} =<q'_w, q'_x, q'_y, q'_z>$. See picture:

I'd like to find a transformation between two coordinate systems from the known values $\mathbf{q}$, and $\mathbf{q'}$. By doing that, I want to transform $\mathbf{q'}$ to the values with respect to original coordinate.
I'm not very familiar with quaternion, but the measurement systems I have give orientation values only in quaternion.
I saw following post, but it won't helpful to my problem. How can I transform coordinate systems with quaternions?
Could anyone help me please? Thank you :)