In both diagrams in the question, the left wheel has a smaller radius at the contact point than the right wheel. Because they're fixed to a common axle, in any given amount of time, the right wheel will travel a greater distance than the left, so the axle as a whole will rotate anti-clockwise (when viewed from above) about a vertical axis. As it does this, it will start to lie diagonally across the track, rather than perpendicular to the two rails.
Suppose we're using the wheel profile in the first diagram. As the axle gets farther from perpendicular, the right wheel moves ahead and drops down to have a lower-radius part in contact with the rail. This means that the axle is self-straightening since the more it steers, the more it tends to push itself back towards being perpendicular.
However, if we use the second wheel profile, as the axle gets farther from perpendicular, the right wheel climbs up the rail, causing the contact point to move to an area of higher radius. That means the right wheel goes even farther in one revolution, so it turns even more. That's completely unstable.
In the second diagram, the only way the axle can return to running straight is for the whole axle to rotate clockwise about a horizontal axis, with the wheels sliding perpendicularly across the rails. That would cause a huge amount of wear to both the wheels and the track, assuming the thing didn't just derail.
There's a Numberphile video demonstrating all of this with a few taped-together espresso cups.