The black and blue dress "changed" colour depending on what ambient light was around. Your eyes adjust themselves so that a red flower in morning light still
looks the same red in evening light, even though the actual wavelengths of light have changed.
But the dress, in a photograph, did not give any clues about the kind of ambient light around, so your brain decided on whether is was morning or evening light, and adjusted the colours you perceive differently, according to the light conditions the brain had decided were prevalent.
Vision is an incredibly complicated sense.