The Stars will get a third-round pick in the 2016 draft in Friday's deal.
The 24-year-old Dillon has nine goals and 17 assists in 149 career games with Dallas. He had one assist in 20 games this season, along with 26 penalty minutes, 27 hits and 29 blocked shots.
Sharks general manager Doug Wilson calls Dillon a ''late-blooming'' player whose game is trending up and who will help San Jose for the present and future.
The 26-year-old Demers has 16 goals and 82 assists in 300 career games. He has three assists in 20 games this season.