Mapping of unknown environment

My question is how do obtain occupancy grid map given sensor data of a robot? . I searched a lot and concluded that by using proximity sensors (rangefinders, sonar) and putting that data in occupancy grid mapping algorithm one can obtain grid maps. Am i right in that or not? If not kindly correct me because still i am stuck at that point after a lot of literature search.

$$T_{world}^{robot}*T_{robot}^{sensor}*T_{sensor}^{object}=T_{world}^{object}$$