An iterative clustering algorithm for the Contextual Stochastic Block Model with optimality guarantees