Yes, it seems it is legal, even in the UK, to have a washing machine under a basin, as long as the power socket is at least 3m horizontally from the edge any bath or shower. Not much different from under a sink in the kitchen, I suppose.
There’s a compact waste assembly behind the machine, which looks to take up a depth of about 6 inches. They’ve obviously cheated a bit by using a slim 40cm depth washing machine in the photo.