So you're wanting to automatically make a connection between 2 users based off some pre-defined rules? If am understanding correctly then you could use incubator project CB Queries using the after registration trigger and conditionally check a field to determine who they should be connected to then using queries establish the connection. Example query as follows.
Code:
INSERT IGNORE INTO `#__comprofiler_members` ( `referenceid`, `memberid`, `membersince` ) VALUES ( '[user_id]', 'TEACHERS_USER_ID', NOW() )