Both circuits work essentially the same. It's perhaps slightly easier to understand the second because it's being explicit about what it's doing rather than hiding some of it in an oracle. So, take the second diagram. Consider the effect of the middle gates. They basically say
if the top register is in the all 0 state, flip the bit of the second register
if the second register is in 1, apply a phase. Otherwise, do nothing.
if the top register is in the all 0 state, flip the bit of the second register.
Clearly, the first and the third cancel each other out, meaning that the second register will return as $|0\rangle$. However, it's that middle operation that's important. Expressed as it is, hopefully you see that the overall effect of the three gates is to say "add a phase if the top register is in the all 0 state". Thus, the effect of these 3 gates on the first register can be written as
$$
I+(e^{i\Delta t}-1)|0\rangle\langle 0|^{\otimes n}.
$$
You can now take into account the effect of the other two gates.
$$
H^{\otimes n}\left(I+(e^{i\Delta t}-1)|0\rangle\langle 0|^{\otimes n}\right)H^{\otimes n}=I+(e^{i\Delta t}-1)|\psi\rangle\langle \psi|=e^{i\Delta t|\psi\rangle\langle\psi|}
$$
There seems to be a minus sign inconsistency with what you've posted. I don't know if that's a mistake I've made somewhere...
To check the identity
$$
I+(e^{i\Delta t}-1)|\psi\rangle\langle \psi|=e^{i\Delta t|\psi\rangle\langle\psi|},
$$
it is perhaps easiest to go from right to left. Clearly, the operator $|\psi\rangle\langle\psi|$ is a rank 1 projector, which I'll denote $P_{\psi}$. We can introduce a second projector $P_{\perp}=I-P_{\psi}$. The states that this projects onto all have 0 eigenvalue with $P_{\psi}$.
The definition of the exponential of matrix $M=\sum_j\lambda_jP_j$ is
$$
e^{i\theta M}=\sum_je^{i\lambda_j\theta}P_j.
$$
So,
$$
e^{i\Delta t|\psi\rangle\langle\psi|}=e^{i\Delta t}P_{\psi}+P_{\perp},
$$
which is exactly what we were after.