Do both SH51 and SH56 cleats work with all SPD-compatible pedals? This answer mentions that Shimano makes two kinds of SPD cleats, one that allows unidirectional release (SH51) and one multidirectional (SH56).

Are there other differences between the two? Will both types work with all SPD-compatible pedals? Are there reasons to prefer unidirectional release over multidirectional release?
Yes, all SPD pedals are compatible with both of these cleats. The multi-directional release SH-56 will allow you to pull out of the pedal vertically if it is required. They are designed for spin bikes. (Exercise use.)

The difference is a preference only, because it depends what you intend to use them for. I will not use the SH-56 on the road because I have pulled out of the pedal during normal riding, and offroad has similar issues.