This is absolutely true that they are the same color. I took a small screenshot of each square. But why does this work? That is insane.
I'm guessing this has been replied to a million times by now, but anyways.
The human visual system does not work by just pulling in whatever the eyes are seeing into your mind. Instead the visual system is trying to figure out the context and what the actual objects themselves look like.
Imagine you see a white stone in bright sunshine and next to it you see an identical white stone in the shade. They're obviously very different visually from the big change in light, but your visual system compensates so you can see they're both the same shade of white.
The blue/black or white/gold is similar, but for color.
In bright sunlight the light around us is "white", but the shade is mostly lit up by the sky and significant more blue. Late when it's dusk the sun is much more yellow than at noon.
This all means colors shift a lot so your brain had to compensate. That gif with the dress has it being blue and black in very yellow light and white and gold in very blue light. The original picture worked because it was very overexposed do the white balance in the camera went mad and made it far too yellow and people who see it as black and blue "fix" the off white balance.