Conservation of substance implies that the volume of wine in the barrel holding mostly water has to be equal to the volume of water in the barrel holding mostly wine.
The mixtures can be visualised as separated into their water and wine components:
To help in grasping this, the wine and water may be represented by, say, 100 red and 100 white marbles, respectively. If 25, say, red marbles are mixed in with the white marbles, and 25 marbles of any color are returned to the red container, then there will again be 100 marbles in each container.  If there are now x white marbles in the red container, then there must be x red marbles in the white container.  The mixtures will therefore be of equal purity.  An example is shown below.