Writing to Texture2D

If I have pixel data that I’d like to put into a Texture2D, is there a specific way I should go about it, depending on the bit depth?

I saw some sample code that just takes the first mip and does a copy paste of the data, without calling any sort of method on the texture2d class to inform about the bit depth or anything like that.