IP58 (Z2) vs. IP67 (S5), what's the difference?

Can someone please explain to me how the S5 has IP67 while the Z2 has IP58? The S5 is dust tight while the Z2 dust protected, yet the Z2 has imersion beyond 1 meter while the S5 has immersion up to 1 meter. So my question is, how can the S5 have better dust protection, yet the Z2 have better water protection? Wouldn't better water protection go with better dust protection? Can dust go into places water can't? Which phone is really more sealed against the elements?