How is the SMM2 stage "Do not... look... left..." implemented?

Solution 1:

It looks like there's a couple designs, but they mostly involve Boo, Bob-omb, and Muncher enemies. Basically, there's a Muncher sitting on top of a "eyes closed" Boo, which makes it solid. As soon as you look in the opposite direction, the Boo activates, becoming intangible and allowing the Muncher to fall down. This will trigger the Bob-omb right next to the Muncher, causing it to explode. The explosion will then in turn activate a nearby P-Switch, which of course causes the level to collapse. So, as a hasty ASCII art diagram:

POM     P = P-Switch   O = Bob-omb
XXB     M = Muncher    B = Boo       X = Solid Block

This is the simplest version, but there's more advanced versions as well which can capture the Boo and bring it out of the level.

For more info, here is an informative video tutorial on how these types of levels are crafted.