The nice thing about small Boolean circuits like this, is there are only a few possible inputs.
With two input wires, there are $2^2=4$ possible inputs to your circuit: $00, 01, 10, 11$. You can test each one and write down its output. Then compare that to the XOR gate's outputs.
If the two line up, then the circuits are equivalent! And if they're not, something has to be adjusted.
Just write down what the output of every circuit is. In the first example, the left circuit is X = NAND (a, b), top middle is Y = NAND (a, X), bottom middle is Z = NAND (X, b), right = NAND (Y, Z).
Substitute everything into the eqation for the right circuit, then use Boolean algebra.