Wired had the best explanation of the science behind the dress’s shifting colors. When your brain tries to figure out what color something is, it essentially subtracts the lighting and background colors around it, or as the neuroscientist interviewed by Wired says, tries to “discount the chromatic bias of the daylight axis.” This is why you can identify an apple as red whether you see it at noon or at dusk.
The dress is on some kind of perceptual boundary, with a pretty even mix of blue, red and green. (Frankly, it’s just a terrible, washed out photo.) So for those who see it as white, your eyes may be subtracting the wrong background and lighting.
Changing a color’s appearance by changing the background or lighting is one of the most common techniques in optical illusions. As the examples below show, colors can change dramatically against different backgrounds. (If you’ve ever held a sock up to something black to see whether it was black or navy, you understand the concept.)
For example, in this classic shadow illusion by Edward H. Adelson, A and B are the exact same shade of gray:
Here's a minimalist illustration by Wikipedia user Dodek. The gray bar across the center is actually one constant color:
In this image from BrainDen, the surface colors of A and B are the same. To test it out, just use your finger to cover the middle of the drawing, where the two squares meet.
In this illusion by Barton L. Anderson and Jonathan Winawer, the black and white chess pieces are the same color:
If you want a dog of a different color, just set it against a different background (via BrainDen):
There are actually only three colors in this image -- white, red and green (sorry, color blind people). Also via BrainDen.
The blue and yellow border around this image by Jochen Burghardt creates the illusion that it is pale yellow, instead of white:
Contrasting colors can even give you the illusion of motion, as in this trippy graphic by Paul Nasca:
The same principle is at work in this motion illusion by Japanes professor Akiyoshi Kitaoka called "Rotating Snakes." As you stare at the image, the circles will appear to turn.
If you stare at the center of this illusion by Jeremy Hinton, you will eventually see a revolving green circle. When the lilac disappears, the adaptation of rods and cones in the retina leaves a green afterimage.
In Pinna's illusory intertwining effect, shown here in an illustration by Jochen Burghardt, colors give the illusion that circles are intertwining (they are actually concentric).
But probably the best illusion on the subject of the dress is by Randall Munroe of Xkcd, who immortalized the debate in an optical illusion cartoon form.