Learning Event-triggered Control from Data through Joint Optimization