Provided a DSLR has both i.e. a viewfinder as well as a liveview feature. Which one is more preferable for focusing and composition, and why?
Is there something which can be done through a viewfinder but not through a liveview or the vice versa?
It would depend on the specific camera, but in many cameras Live View will show 100% coverage (the final image will be the same as what you see in the LCD) where the viewfinder may only be 95% (true on certain Nikon models at least).
Live View uses a different autofocus mechanism, which seems slower to me, but is said to be more accurate. It is often used to focus in landscape and macro photography, and has the advantage that you can even zoom in on your subject to check focus more accurately.
Live View has a distinct advantage in low light where the image on the LCD will be brightened so it is easier to see your subject and compose, whereas the viewfinder will become dim as the light fades.
Live View will be a drain on the battery.
When I want to have the fastest responsiveness, I use the viewfinder.
When making careful compositions where I'm using a tripod and have the luxury of time, I prefer using live view in combination with a loupe. I use the Hoodman Hoodloupe: