Answer Explanation
Lets consider the two cases. In the first case the ray is going from the denser to the rarer medium while in the second case it is going from the rarer to the denser medium.

Here we have two cases, in the first figure ray goes from denser to rarer medium i.e., u
2 < u
1 while in the second figure u
2 > u
1.
In both cases , we can apply snail's law as:
u
1sini = u
2sinr
If angles are small we get:
u
1tani = u
2tanr . ............... (i)
In both cases, the real depth is BO while the apparent depth is BI.
Thus, using (i) we get:
u
2/ u
1 =
tani/
tanr = (BA/OB) / (BA / BI) = BI / BO = (apparent depth) / (real depth).
Now, in your case we are watching from a denser medium, so figure (ii) will represent your question.
So, if in figure (ii) u
1 is R.I. of air then we can put u
1 = 1 and u
2 = u.
So, we get :
u = (apparent depth) / (real depth). It can be verified too , as we know that u is more than one (refractive index of a medium denser than air).
And the apparent depth is more than real depth too as when we produce the refracted ray backwards it meets the normal at a point behind the point the light actually imerges from.
I would suggest that , you should always draw the ray diagram in these cases rather than applying the direct formula.
Real depth is the depth of the object while apparent depth is the depth of the image.