The formula will work anytime the cross-sectional area varies with the height as a parabolic function. This includes cones, pyramids, etc., which vary as A = h², and also spheres, hemispheres, etc., which vary as A = 1 - h². (A = area, h = height.) Are there others?
* * * * *
Thinking about this a little more, it makes sense that this application of Simpson's Rule gives the exact value when the relationship between the cross-sectional area and height follow a parabolic function, since Simpson's Rule basically looks for the parabola that best fits a function. Obviously, if the function is quadratic, then the best fit is the function itself.
I suppose that the cross-sections for prisms do not vary, i.e. follow the constant function A = c for some value c. Since this equation also works for prisms, we can call this a second class of solids for which the formula works. On the other hand, we can think of a constant function as a "flat parabola", i.e. A = 0h² + c, and argue that the quadratic relationship still holds.