This can't really be done in a relational database, at least not in a way that actually uses a constraint. You can do it without using a constraint though this is obviously unsafe. What you could do is use two attendance entities, one for each type. Or you could use two key columns in your attendance table and a constraint to prevent values appearing in a row for both.
Before adding a new student/staff to the database a new id will be inserted into person table, then student/staff will be added to the appropriate table. In the same way attendance table will also refer to person table. Indirectly it is referring to student and staff tables.