As long as a fly fits in a box without being crushed it's fine. There are certain boxes made expressly for certain flies like the compartmented box Mark mentioned. There are many other types, such as large, flat boxes with foam on one side that are meant for streamers. There are many, many types, but the most common are the ones like you posted.
I have so many types of fly boxes that I can't even count any more. My current favorite is the LL Bean box with the green back and clear lid, and a lanyard that you can hang around your neck. I also use a small metal Wheaton fly box that was a gift from my wife (good woman
) for most of my trout fishing and dry flies.