There are 5! (5 x 4 x 3 x 2 x 1 = 120) potential different arrangements for 5 people picked at random. Of those, let's take a look at all of the possible arrangements with Mary and Bob next to each other:
MBXXX
BMXXX
XMBXX
XBMXX
XXMBX
XXBMX
XXXMB
XXXBM
There are 8 arrangements out of the 120 where Mary and Bob are next to each other, which means that they have an 8/120 = 1/15 chance of ending up in that situation.