The two are the same, one is a context manager, the other is a function decorator. It is the same as running your whole function in with torch.no_grad(). So it is quite convenient.
The problem is that .data can hide some errors and give you wrong gradients.
For example, this issue poped up today: https://github.com/pytorch/pytorch/issues/30073 8 which is caused by the use of .data in the old codebase.