Information we have:
Mary spent $58, and this must be twice as much as what John spent.
John paid $4 per eraser, this will be represented by 4x, and since he also paid a shipping fee of $5, his total is:
4x+5
Now we use the information we had: Mary spent twice as much as John.
And twice as much as John is:
2(4x + 5)
And finally, this must be equal to what Mary spent which is $58:
2(4x + 5)=58