The top one is correct. The valve piston should block flow from the holes nearest the bolt head through to the second set of holes, you can see it is blocking the second set. There's a smaller diameter to the center hole where the piston is stopped - it can't go further in. The spring is against the pin. If filter pressure drop gets high enough to force the piston down against the spring because the filter is blocked by crud (like maybe the filter hasn't been changed for rather a long time), oil can then flow between the end and second sets of holes and bypass the filter.
With the parts reversed, you bypass oil all the time and the filter is useless.