Yes, a dataset instance should be an instance of a class derived from torch.utils.data.Dataset. So, torchvision.datasets.MNIST and torch.utils.data.TensorDataset are both derived from torch.utils.data.Dataset.
Please, see this docs for more details:

  
      pytorch.org
  
  
    

torch.utils.data — PyTorch 1.7.0 documentation 1