Yes of course.
Fasting is not taking in anything solid (well that's how I do it).
The 5:2 diet is simply limiting calorie intake on 2 days out of 5 so not fasting per se... just eating less 2 days a week.
They compared this with just eating an average of fewer calories over a week so... 5:2 you have severe calorie restriction for 2 days...the other just less severe calorie restriction over 7 days.
Fasting would be say only eating once per day (Intermittent Fasting) or not eating for multiple days (Extended Fasting).
I hope that makes my point a bit clearer.
Fasting also has benefits.. by not eating we can reduce the number of times a day insulin production is stimulated.