With the help of D-Link tech support, I am able to get WDS working. Here are the steps.
1. Connect internet(WAN) cable to 1st router. Configure its wireless mode as "WDS + AP + Router".
2. On the 2nd router, disable DHCP server and configure router IP address as "192.168.0.2". Configure wireless mode as "WDS + AP"
3. Configure the same SSID, wireless security settings and wireless channel on both the routers.
4. In router 1, configure the router 2 mac address(from the backside of the router) in the Wireless Settings->Bridge Settings->Remote Mac address.
5. Similarly, configure the router 1 mac address in router 2->wireless Settings->Bridge Settings->Remote MAC address.
With the above step, WDS is working. I haven't tried configuring bridge security though.