If we suspend the given bars with a silk thread such that it is free to rotate in a horizontal plane, then we will observe that one bar always sets itself in geographical north south direction as shown in the picture given below, while the other bar sets itself in any direction.
This happens because a magnet when suspended freely will rest only in north-south direction, but soft iron bar will rest in any direction. Hence, by suspending the two given bars freely and observing the position in which they rest we can distinguish between a magnet and a soft iron bar.